export default function message(state = [], action) {
  const { type, payload} = action;
  switch (type) {
    case 'ADDMESSAGE':
      return [...state, ...payload];
    case 'DEL':
      const newState = [...state];
      return newState.pop();
    default:
      return state;
  }
}